drm/vmwgfx: fix integer overflow in vmw_surface_define_ioctl()
authorLi Qiang <liq3ea@gmail.com>
Tue, 28 Mar 2017 03:10:53 +0000 (03:10 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 30 Mar 2017 01:16:33 +0000 (01:16 +0000)
commita2ca8cfb84a1eb436804b93876ce276eebabe870
tree754e40693180b128ccf6f71d9e0185c034fc340f
parent663f5e25dd9303417885ae76c87dd094c8b8ca97
drm/vmwgfx: fix integer overflow in vmw_surface_define_ioctl()

In vmw_surface_define_ioctl(), the 'num_sizes' is the sum of the
'req->mip_levels' array. This array can be assigned any value from
the user space. As both the 'num_sizes' and the array is uint32_t,
it is easy to make 'num_sizes' overflow. The later 'mip_levels' is
used as the loop count. This can lead an oob write. Add the check of
'req->mip_levels' to avoid this.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
Gbp-Pq: Topic bugfix/x86
Gbp-Pq: Name drm-vmwgfx-fix-integer-overflow-in-vmw_surface_define_ioctl.patch
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c